package com.mq.demo.controller;

import com.mq.demo.service.MQServiceImpl;
import com.mq.demo.utils.JsonResult;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Re
 * @create 2023/2/28 17:03
 * @Description mq控制层
 */
@RestController
@Log
public class MQController {

    @Autowired
    private MQServiceImpl mqService;

    @RequestMapping("/sendMsg")
    public JsonResult sendMsg(String msg){
        log.info("发送消息 ===>>>" + msg);
        mqService.sendMessage(msg);
        return new JsonResult();
    }

    @RequestMapping("/sendOneWayMq")
    public JsonResult sendOneWayMsg(String msg){
        log.info("发送消息 ===>>>" + msg);
        mqService.sendOneWayMq(msg);
        return new JsonResult();
    }

    @RequestMapping("/sendTransactionMsg")
    public JsonResult sendTransactionMsg(String msg, Integer arg){
        log.info("发送消息 ===>>>" + msg);
        mqService.sendTransactionMsg(msg,arg);
        return new JsonResult();
    }

}
